From 3353d528b453f8987d042beb2cf2ac7c59a7ba3f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 5 Dec 2005 20:51:18 +0000 Subject: [PATCH] Use g_slice instead of mem chunks. 2005-12-05 Matthias Clasen * gdk/gdkevents.c: * gdk/gdkcolor.c: Use g_slice instead of mem chunks. --- ChangeLog | 3 +++ ChangeLog.pre-2-10 | 3 +++ gdk/gdkcolor.c | 13 ++----------- gdk/gdkevents.c | 17 ++--------------- 4 files changed, 10 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed7e604c96..727b97919a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-12-05 Matthias Clasen + * gdk/gdkevents.c: + * gdk/gdkcolor.c: Use g_slice instead of mem chunks. + * gtk/gtktreeview.c (gtk_tree_view_key_press): Free new_event after sending it to the search entry. (#323209, Crispin Flowerday) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ed7e604c96..727b97919a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,8 @@ 2005-12-05 Matthias Clasen + * gdk/gdkevents.c: + * gdk/gdkcolor.c: Use g_slice instead of mem chunks. + * gtk/gtktreeview.c (gtk_tree_view_key_press): Free new_event after sending it to the search entry. (#323209, Crispin Flowerday) diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c index 404dd3dc8c..83da2cddef 100644 --- a/gdk/gdkcolor.c +++ b/gdk/gdkcolor.c @@ -103,8 +103,6 @@ gdk_colors_store (GdkColormap *colormap, gdk_colormap_change (colormap, ncolors); } -static GMemChunk *color_chunk; - /** * gdk_color_copy: * @color: a #GdkColor. @@ -121,13 +119,7 @@ gdk_color_copy (const GdkColor *color) g_return_val_if_fail (color != NULL, NULL); - if (color_chunk == NULL) - color_chunk = g_mem_chunk_new ("colors", - sizeof (GdkColor), - 4096, - G_ALLOC_AND_FREE); - - new_color = g_chunk_new (GdkColor, color_chunk); + new_color = g_slice_new (GdkColor); *new_color = *color; return new_color; } @@ -142,10 +134,9 @@ gdk_color_copy (const GdkColor *color) void gdk_color_free (GdkColor *color) { - g_assert (color_chunk != NULL); g_return_if_fail (color != NULL); - g_mem_chunk_free (color_chunk, color); + g_slice_free (GdkColor, color); } /** diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 040ebc292f..dc85f9eb9f 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -255,7 +255,6 @@ gdk_event_put (GdkEvent *event) gdk_display_put_event (display, event); } -static GMemChunk *event_chunk = NULL; static GHashTable *event_hash = NULL; /** @@ -275,17 +274,7 @@ gdk_event_new (GdkEventType type) GdkEventPrivate *new_private; GdkEvent *new_event; - if (event_chunk == NULL) - { - event_chunk = g_mem_chunk_new ("events", - sizeof (GdkEventPrivate), - 4096, - G_ALLOC_AND_FREE); - event_hash = g_hash_table_new (g_direct_hash, NULL); - } - - new_private = g_chunk_new (GdkEventPrivate, event_chunk); - memset (new_private, 0, sizeof (GdkEventPrivate)); + new_private = g_slice_new0 (GdkEventPrivate); new_private->flags = 0; new_private->screen = NULL; @@ -446,8 +435,6 @@ gdk_event_free (GdkEvent *event) { g_return_if_fail (event != NULL); - g_assert (event_chunk != NULL); /* paranoid */ - if (event->any.window) g_object_unref (event->any.window); @@ -498,7 +485,7 @@ gdk_event_free (GdkEvent *event) } g_hash_table_remove (event_hash, event); - g_mem_chunk_free (event_chunk, event); + g_slice_free (GdkEventPrivate, event); } /** -- 2.30.2